<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <link rel="stylesheet" href="../../css/animate.css">
  <link rel="stylesheet" href="../../iconfont/iconfont.css">
  <link rel="stylesheet" href="../../css/mescroll.css">
  <link rel="stylesheet" href="../../css/gloab.css">
  <title>我的分站</title>
  <style>
    .add-modify-center{
      -moz-box-shadow:0px 0px 3px rgba(76,154,245,0.15);
      -webkit-box-shadow:0px 0px 3px rgba(76,154,245,0.15);
      box-shadow:0px 0px 3px rgba(76,154,245,0.15);
      border-radius:0.14rem;
    }
  </style>
</head>
<body>
  <div id="app">
    <div id="public-header" style="padding-bottom:1rem;">
      <div id="statusbar"></div>
      <header class="public-header">
        <div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
        <div class="public-header-title">我的分站</div>
      </header>
    </div>
    <div class="fenzhan-body" style="user-select:text;padding:0 0.25rem;">
      <div class="fenzhan-body-title">我的推广网站</div>
      <span id="text" class="fenzhan-body-link" v-model="url" style="display: inline-block;width:70%;padding:0.01rem 0.5rem;overflow:hidden;">
         <span style="display: inline-block;width:70%;padding:0.01rem 0.5rem;overflow:hidden;">{{url}}</span>
      </span>
      <p style="color:#afb3b9;margin-top:0.2rem;">长按选择复制链接加上文字推广即可</p>
    </div>
    <div class="add-modify-center" style="margin-top:0.36rem;height:auto;padding:0.24rem 0;">
      <div class="add-modify-title" style="margin-top:0;" style="user-select: text">我的推广二维码</div>
      <div class="add-modify-text" style="width:86%;margin:0 auto;font-size:0.24rem;padding-bottom:0.24rem;">此处的二维码跟推广海报上的二维码性质一样，均有锁粉功能</div>
      <div class="add-modify-ewm" style="margin-top:0.24rem;margin-left:0.5rem" id="qrcode" ref="qrCodeDiv">
        <img id="img">
      </div>
    </div>
    <div class="add-modify-btn" id="dadsa"   @click="downloadClick">保存</div>
  </div>
  <div class="public-progress" style="z-index:9;" id="">
   <img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
  </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/mescroll.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/qrcode.js"></script>
<script src="../../script/html2canvas.js"></script>
<script src="../../script/fastclick.js"></script>

<script>
var vm;
var mescroll;
apiready=function(){
  api.removeLaunchView();
  setBar("statusbar");
  setFont(750);
  startVue();
  $(".public-progress").fadeOut(1000);
  setTimeout(function(){
    $(".public-progress").css({"display":"none"});
  },2000);
}
function startVue(){
  vm = new Vue({
    el:"#app",
    components: { QRCode },
    data:{
      gdtt:['100','1000','5000','10000','20000','50000'],
      num:0,
      url:'',
      dataURL:'',
      image:'',
	  uid:''
    },
    created:function(){
	  this.getCopyList();
    },

    methods:{
		getCopyList: function() {
			api.closeFrame({
				name: 'zhanzhang'
			});
			api.ajax({
				url: apiUrl + '/api/user/recdesc',
				method: 'post',
				data: {
					values: {
						token: $api.getStorage('token')
					},
				}
			}, function(ret, err) {
				console.log(JSON.stringify(ret))
				if (ret.code==1) {
					vm.uid=ret.data.uid;
					vm.getUrl(vm.uid);
					vm.erwei();
				} else {
				}
			});
		},
      getUrl:function(uid){
        var self = this;
        // self.url = apiUrl+"&pid="+$api.getStorage("uid");
        self.url = apiUrl1+"/index/index/index/pid/"+uid;
      },
      erwei:function(){
        var  FNScanner = api.require('FNScanner');
        FNScanner.encodeImg({
            content:this.url,
            saveToAlbum: false,
            saveImg: {
                path: 'fs://album.png',
                w: 200,
                h: 200
            }
        }, function(ret, err) {
            if (ret.status) {
                document.getElementById('img').src = api.fsDir + '/album.png';
            }
        });
      },
      downloadClick:function(){
        var  FNScanner = api.require('FNScanner');
        FNScanner.encodeImg({
            content:this.url,
            saveToAlbum: true,
            saveImg: {
                path: 'fs://album.png',
                w: 200,
                h: 200
            }
        }, function(ret, err) {
            if (ret.status) {
              api.toast({
                  msg: '保存成功',
                  duration: 2000,
                  location: 'middle'
              });
            }
        });
      }
    }
  })
}
</script>
</html>
